package common.store.admin.contoller;

import common.store.admin.service.SupplierService;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/supplierDel")
public class SupplierDelServlet extends HttpServlet {

    private SupplierService supplierService;

    @Override

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String sid = req.getParameter("sid");
        Integer rows = supplierService.delCategoryBySid(req.getParameter("sid"));
        if(rows > 0){
           /* req.setAttribute("categoryList" , categoryService.getCategoryList());
            req.getRequestDispatcher("/admin/category/list.jsp").forward(req , resp);*/
            resp.sendRedirect(req.getContextPath() + "/supplierList");//刷新页面过程
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req , resp);
    }
}
